OssaNMA: An R package for using information from network meta-analyses to optimize the power and sample allocation of a new two-arm trial

Randomized clinical trials (RCTs) are designed for measuring the effectiveness of the treatments and testing a hypothesis regarding the relative effect between two or more treatments. Trial designers are often interested in maximizing power when the total sample size is fixed or minimizing the required total sample size to reach a pre-specified power. One approach to maximizing power proposed by previous researchers is to leverage prior evidence using meta-analysis (NMA) to inform the sample size determination of a new trial. For example, researchers may be interested in designing a two-arm trial comparing treatments A and B which are already in the existing trial network but do not have any direct comparison. The researchers’ intention is to incorporate the result into an existing network for meta-analysis. Here we develop formulas to address these options and use simulations to validate our formula and evaluate the performance of different analysis methods in terms of power. We also implement our proposed method into the R package OssaNMA and publish an R Shiny app for the convenience of the application. The goal of the package is to enable researchers to readily adopt the proposed approach which can improve the power of an RCT and is therefore resource-saving. In the R Shiny app, We also provide the option to include the cost of each treatment which would enable researchers to compare the total treatment cost associated with each design and analysis approach. Further, we explore the effect of allocation to treatment group on study power when the a priori plan is to incorporate the new trial result into an existing network for meta-analysis.


Introduction
Randomized clinical trials (RCTs) are designed for measuring the effectiveness of the treatments and testing a hypothesis regarding the relative effect between two or more treatments.Some important aspects of trial design include calculating the required sample size to achieve the desired level of power and optimizing the allocation of the total sample size to the treatment groups to maximize the power.However, it can be difficult for a single trial to achieve a sufficient level of power with resources limited or constrained by the facility.To improve the power of trials to detect meaningful difference in effect, evidence synthesis can be used, such that, there is an a priori plan is to incorporate the new trial result into an existing trial network for meta-analysis (NMA).Researchers have proposed methods to plan a randomized clinical trial specifically to update a pairwise meta-analysis [1,2] and others have recently extended to NMA [3][4][5].There have been a few published applications of the use of NMA to inform the sample size [6,7] of future trials.
Determining the sample size is an important part of designing RCTs to address a specific scientific question with a pre-specified power.Sutton et al. (2007) [1] described a simulation approach to sample-size estimation for a new trial based on the result of an updated meta-analysis.Roloff et al. (2012) [2] proposed a method based on the conditional power of a meta-analysis to aid the planning of future trials that avoids the need for simulation, where conditional power is defined as the power to detect a specified overall mean effect size given the existing evidence.Nikolakopoulou et al. (2014) [3] provided recommendations for further clinical trials using conditional power of NMA.When compared to the optimal sample size obtained from traditional methods of sample size calculations that use estimates of effect and variance, the estimated optimal sample size of the conditional power method was much smaller.The focus of the work from [3] was to design a series of future two-arm clinical trials with the optimal total sample size for each trial to achieve a pre-specified power.However, designing a series of future trials at the same time is rare in practice.A more common question is the design of a single trial of interest to the researcher with the goal of having the most powerful approach to comparing two treatments.To illustrate the problems above, we concentrate on a special future two-arm study with a binary outcome, which has two arms already in the existing trial network but does not have any direct comparison.Under that condition, we propose a method to calculate the optimal sample size and allocation for each treatment with a fixed total sample size or a pre-specified power.
In addition to determining the optimal sample size for each treatment in a future two-arm trial, another important question is how to make the implementation of the method easier for the trial planners.To use these methods proposed, the results of network meta-analysis of the existing evidence are required.Furthermore, the optimization problems that need to be solved do not have closed-form solutions for sample sizes.Therefore proposed methods require the end-users to conduct a network meta-analysis and solve a non-linear optimization problem.Although packages and code for each aspect of the process are available, these can be difficult to use and be combined, particularly for non-statisticians, which are often the investigators who conduct RCTs.Therefore, we aim to build two tools to make our proposed method accessible and flexible: the first tool is an R [8] package OssaNMA, which calculates the sample size for each treatment group for the new two-arm trial.The second tool is an R Shiny [9] app, which is a user-friendly web-based application of the OssaNMA that gives investigators a webbased interface to obtain the optimal sample size for their future two-arm trial.
To summarize, we have three aims.First, we aim to provide the optimal sample size for each treatment in a future two-arm trial with fixed total sample size.We document the increase in power associated with pre-planning to include the new trial in a network metaanalysis.We also investigate the magnitude of the difference in power between even allocation and the optimal allocation to group, based on the existing evidence.Second, because researchers may not have a fixed sample size, but rather a pre-specified power, we also calculate the optimal sample size for each treatment in a future two-arm trial in order to achieve a pre-specified level of power, based on the existing evidence as well.Finally, we would introduce our R package OssaNMA and our R Shiny app, which are designed to facilitate the calculation of the optimal sample size mentioned in our first two aims.
We organize the rest of the paper as follows.In Materials and methods, we briefly overview the fixed effect network meta-analysis and derive expressions for the optimization problems to solve in order to obtain the optimal sample size or power under different scenarios.In Application and simulation, we report the application and simulation.In Results, we present the simulation results in different scenarios.In Application tool: R Shiny webpage, we provide a detailed tour of the R Shiny webpage and illustrate its use in a 'real-world' setting.In The package, we introduce OssaNMA package.An empirical illustration of applying the package is provided in Empirical illustrations.In Discussion and Conclusion, we discuss the potential implications and limitations of our proposed method and tool.

Materials and methods
Suppose a new two-arm trial is to be conducted comparing treatment A and B. The researchers can be in two circumstances.First, they may have a fixed total sample size due to financial or facilities limitations.In such a circumstance, the goal is to maximize the power of the new trial when the total sample size is fixed.Alternatively, some researchers may want to reach a prespecified power and therefore the goal is to minimize the required total sample size.
The organization of the five subsections is structured as follows: in the first subsection, we discuss the traditional approach to sample size determination and optimal sample size allocation with a fixed total sample size without an existing NMA.In the second subsection, we provide a brief introduction to the fixed-effect network meta-analysis model, which provides the theoretical basis for the next subsection, in which we derive the formula for the variance of the estimated relative effect size when we analyze the new trial with the existing network, and then utilize this variance estimate to determine the optimal allocation of study subjects to groups under a fixed total sample size in the final subsection.Fig 1 illustrates the key formulas for calculating the optimal sample size allocation with a fixed total sample size.
In addition to solving the optimization problem related to maximizing the power with a fixed total sample size, a method to minimize the total sample size required when the goal is to achieve a pre-specified power is also vital.We provide he formula for the power when the new trial is analyzed with or without the existing trial network by utilizing the variance estimate.Given the formula of power, we document the approach to obtaining the optimal sample size when the goal is to reach a pre-specified power.Fig 2 summarises the key parts in for calculating the optimal required sample size and how to allocate it with a pre-defined power.

Traditional methods for a two-arm trial
Suppose the total sample size, n, for the new two-arm trial is fixed.We want to obtain the best sample allocation strategy by minimizing the standard error of the estimated effect size.Let the number of samples assigned to treatment A and B be n A and n B , respectively, under the condi- Suppose the outcome is binary such as a disease event.To simplify the notation, we use r i to denote the number of events in the i-th treatment, π i to denote the probability of an event occurring in treatment i, i 2 A, B.
The logistic regression model for this problem is Let μ AB,trial be the relative effect size of treatment B to A, and mAB;trial be the estimate of μ AB,trial .We have mAB;trial ¼ b2 : Let s 2 AB;trial be the variance of mAB;trial .Then where p i = r i /n i is the estimated π i for i 2 A, B. Hence, the optimization problem is Suppose the outcome is continuous such as a production metric like average daily gain.Let y s denote the outcome in the s-th animal and Trt s denote the treatment that the s-th animal received.The linear regression model for s = 1, � � �, n is where � s is iid with N(0,σ 2 ).
Using the same notation as the binary case, we have mAB;trial ¼ b2 : and To minimize Varð b2 Þ, the optimal allocation would be n A ¼ n B ¼ n 2 if σ 2 is assumed known.In the case of a binary outcome (Eq 2), it is straightforward to tell that the optimal allocation approach would be uneven unless p A = p B whereas even allocation is always the optimal in the continuous case.

Fixed-effect network meta-analysis (NMA) model
Consider a network of T treatments with I studies, with the ith study having n i arms.The treatments in each study form a subset of T treatments.There are T

À �
pairwise comparisons, each associated with a relative treatment effect.We denote all the treatment effects by a vector μ f .A critical aspect of our network meta-analysis model is the consistency assumption [10][11][12], which allows pairwise comparisons between the treatments of interest to be estimated as functions of the basic parameters.The basic parameters are the relative effects of all treatments to the baseline treatment.For example, there are three treatments A, B and C in the network and A is chosen to be the baseline treatment.The consistency assumption is written as: A fixed effect NMA assumes that there is only one effect size underlying the trials for each comparison.It follows that all of the differences in the observed effect sizes of a pairwise comparison are due to random variation (sampling error) [13].For example, let y j,AB be the observed effect size of treatment B to A in the j-th studies contains treatments A and B.Then, where � j is the within-study error.
In a network of T treatments with I studies, assume there are n i treatments in study i.Let y i denote the observed effect size for the ith study, y i = (y i,1 , . .., y i,ni −1) T and y = (y 1 , . .., y I ).Let μ i be the vector of the true effect sizes of study i and μ s = (μ 1 , . .., μ I ).Then we have where � i represents the vector of errors of study i. � i is assumed to be normally distributed and independent across studies and its covariance is cov(� i ) = S i .S i is a diagonal matrix of size (n i − 1) × (n i − 1) and is a scalar if study i only has two arms.The distribution of y is y � MVNðμ s ; SÞ; where S is a block diagonal matrix with each block S i , i = 1, . .., I. Let μ be a sub-vector of μ s of length T − 1 that involves the relative effect sizes of all treatments to a baseline.We name the comparisons in μ basic comparisons.Apparently, μ s is a linear combination of μ and can be written as μ s = X μ , where X is the design matrix of size P j j¼1 n j � ðT À 1Þ.Each row of X corresponds to a treatment comparison in a study and each column represents a basic comparison.There are only two possible situations in each row of X.First situation is that there is only one element of 1 and other elements are 0, when this comparison is a basic comparison.The second situation is that 1 and -1 occur in one row and others are 0, when this comparison can be written as a function of the basic comparisons, which is contingent on consistency assumption.The distribution of y is then y � MVNðXμ; SÞ: The maximum likelihood estimate of μ and its variance are

Analysis of the new trial with the existing trial network
Suppose the researchers aim to conduct a new two-arm trial comparing treatment A and B, where A and B are treatments included in the existing network but do not have direct comparison i.e. no trial comparing A and B is available.Let μ AB,uNMA be the relative effect size of treatment B to A, and mAB;uNMA be the estimate of μ AB,uNMA .In this notation, uNMA is used to represent the updated NMA.
As A and B are already in the existing trial network, we can leverage indirect information from the existing network to reduce the standard error of the estimated effect size between A and B. Let the estimate of the effect size of B to A and its variance calculated from the existing network be y AB,eNMA and s 2 AB;eNMA , respectively.In this notation, eNMA is used to represent the existing NMA.Let y AB be the estimated relative effect size and s 2 AB;trial be the variance of y AB when we analyze the new study in isolation, in other words, in the traditional way.Without loss of generality, suppose the baseline treatment is A. We denote the variance-covariance matrix of the updated trial network as S* and the updated design matrix as X*.
where X new is the design matrix of the new trial.By Eq (3), the variance of mAB;uNMA is given by Obviously, we only need to minimize s 2 AB;trial in order to minimize Varðm AB;uNMA Þ given the fixed existing network.Therefore, even though the variances of the estimated effect size are different when we analyze the new trial with or without the existing network, the optimal sample size for each method is the same.This characteristic is attributable to the optimization problem described in Eq (2).

Power calculation for trial with pre-planned analysis with NMA
In this section we present the formula for how to estimate the power for a fixed total sample size when the intention is to analyse the trial result within an NMA i.e., the probability that the effect size on log odds ratio scale between two treatments will be statistically significant under a specific alternative hypothesis.Let the null hypothesis H 0 for the comparisons AB be μ AB = 0. Let μ AB 6 ¼ 0 be the alternative hypothesis H 1 .Define the significance level to be 0.05, then the expressions for the power for the alternative hypothesis is given by where lor denotes the log odds ratio between treatment A and B; s.d denotes the population standard deviation of the effect size lor; z 0.975 is the 0.975th quantile of the normal distribution; F(.) denotes the cdf of the standard normal distribution.
Consistent with the notation used in previous sections, π i and n i denote the risk and the sample size of treatment i, i 2 A, B, s 2 AB; eNMA represents the estimated variance of the relative effect for comparison AB. lor is calculated based on π A and π B .As s.d., the standard deviation of the effect estimate, is unknown and we use the standard error of the estimated effect size (σ AB,uNMA ) of the A and B comparison from the NMA instead.The standard errors are different when we analyze the new trial with or without the existing network.Gathering the values of s 2 AB;eNMA from the existing network, the risk of each treatment, and the sample size of each treatment in the new trial, we can construct expressions for the estimates of s.d by applying Eqs (1) and (4) as Sample size calculation for trial with pre-planned analysis with NMA Given the power formula in the previous section, it is straightforward to write the optimization problem of the scenario where a pre-specified power is the goal and the researchers intend to analyze the new trial with the existing network.Suppose the pre-specified power is 0.8, the optimization problem is where

Application and simulation
Here we conduct two simulation studies to assess the proposed method to design a new twoarm trial while borrowing information from the existing network and comparing it to the traditional methods.In Dataset description, we describe the existing NMA dataset of Bovine Respiratory Disease (BRD) in our application.Simulation I aims to evaluate analyzing the new trial with and without the existing network given a fixed total sample size.We also include an evaluation of the allocation of study participants to treatment group i.e. optimal versus even to determine if this has an impact on the power of the new trial.Through the value of power, standard error (SE) of the estimated effect size, we evaluate differences in power between analysis with and without the network and optimal allocation and even allocation.Simulation II generates the optimal sample size allocation given the condition that the power is at least 80% when analyzing the new trial with the existing network, and compares this sample size required to the traditional design method without the existing network.Here we also look into two optimal sample size strategies for the binary outcome, one is the optimal sample size without the constraint of even allocation, the other is the optimal sample size with the constraint of even allocation.The required total sample size, value of power, and SE of the estimated effect size are calculated to compare different sample size allocation strategies and different analysis methods.

Dataset description
A previously published network of interventions for the treatment of Bovine Respiratory Disease (BRD) in feedlot cattle is used for the simulation study [14].The dataset is comprised of 98 trials, 13 treatments, and 204 arms.Most trials contain two arms and eight trials contain three arms.A network plot is shown in Fig 3 .Arm-level data are available and the outcome is a dichotomous measurement.To compare treatments, the log odds ratios between pairwise comparisons are calculated.

Simulation I
This section describes how a new trial would be simulated with the optimal or even allocation, and evaluates the performance of analyzing the trial with or without existing network.
The new two-arm trial contains Ceftiofur crystalline acid administered in the pinna (CEFTP) and Tildipirosin administered subcutaneous (TILD), both at the manufacturers recommended dose and regime.These two treatments already appear in the existing trial network but do not have a direct comparison.We set two effect sizes (0.299, 0.5) between CEFTP and TILD on the log odds ratio scale and five total sample sizes (100, 200, 500, 1000, 2000) to formulate 10 scenarios.To simplify the notation, we replace CEFTP and TILD with A and B. For each scenario with total sample size n and effect size lor, the simulation process is as follows: 1. From a network meta-analysis of the existing network, the risk of treatment j is estimated and denoted as p j .The risk of B is re-calculated according to the risk of A and the effect size lor set.
2. For each treatment group with treatment j and total sample size n s,j in study s of the existing data, replace the number of events r s,j with a random number generated from Binom(n i ,p j ).This is the simulated existing data.

Let p A and p B denote the risks of A and B calculated in
Step 1.We find the optimal animal allocation (n A , n B ) by solving the optimization problems in Eq (2). 4. Data representing the new study is generated by sampling r i from Binom(n i , p i ), i 2 {A, B}.
5. The simulated data are analyzed by logistic regression.We use the term "analyze without existing network" in the following contents to denote this step.
6.The point estimate and its standard error for the comparison of A and B are extracted from the result.
7. Use a 0-1 indicator to denote if there is a significant difference between the comparison of A and B (α = 0.05).
8. We then calculate the power and standard error of the estimated relative effect size using the formula in Eqs ( 5) and ( 6) 9. The point estimate and its standard error for the comparison of A and B from step 5 are added to the simulated existing data to represent a row of study-level data.We use network meta-analysis to analyze the combined data, which refers to "analyzed with existing network" in the following contents.Repeat Step 6 to 8 for the new result, which is generated by analyzing with existing network.
10.We then re-generate the new study by sampling r i from Binom(n/2, p i ), i 2 {A, B}.Repeat Step 5 to 9 for this new study.
11. Repeat steps 2-10 10,000 times.Calculate the proportion of the indicator equal to 1 to obtain the simulation power and average the powers in Step 8 to obtain the formula power.Likewise, obtain the simulation standard error and the formula standard error.

Simulation II
We explain the process of simulation to evaluate the performance of analyzing the new trial with or without existing network when the optimal allocation for each treatment is determined the mimimum total sample size required to reach the pre-specified power.
The two treatments in the new trial are the same as Simulation I and the desired power is 80%.We set four effect sizes (0.299, 0.4, 0.5, 0.6) for four simulation scenarios.For each scenario with the effect size lor, the process is conducted as below: 1. From a network meta-analysis of the existing network, the risk of treatment j is estimated and denoted as p j .The risk of B is re-calculated based on the risk of A and the effect size lor set.
2. For each treatment group with treatment j and total sample size n s,j in study s of the existing data, replace the number of events r s,j with a random number generated from Binom(n i ,p j ).This is the simulated existing data.
3. Consider analyzing the new trial with the existing network, find the optimal animal allocation (n A , n B ) by solving the optimization problems in Eq (7).
4. Data representing the new study is generated by sampling r i from Binom(n i , p i ), i 2 {A, B}.
5. Analyze the simulated new trial using logistics regression.
6.The point estimate and its standard error are extracted from the result.
7. Use an 0-1 indicator to denote if there is a significant difference between the comparison (α = 0.05).
8. The result from step 5 is added to the simulated existing data to represent a row of studylevel data.We use network meta-analysis to analyze the combined data.Repeat step 6 and 7 for the new result generated by analyzing with existing network.9. Re-generate the sample size for each treatment by add the constraint of even allocation to the optimization problem in Eq (7).Repeat step 4-8 for this new study.
10. Repeat steps 2-9 for 10,000 times.Calculate the proportion of the indicator equal to 1 to get the simulation power.Likewise, we average the sample size n A , n B , and standard error across 10,000 times.

Results
This section summarizes the results of the two simulation studies described previously.The results of simulation I are shown in Table 1.For each fixed total sample size and log odds ratio combination, the results are represented when the new trial has been analyzed with and without the existing network and for two sample size allocation strategies: even allocation and the optimal allocation.We report the following four metrics: simulation power, formula power, simulation SE, formula SE.Power and SE are calculated using two methods: directly from the formula, and, summarized from simulation, to verify the correctness of our simulation process.The simulation power and simulation SE should be equal to the formula power and formula SE as long as the iteration of the simulation is large enough.
In Table 1 we can see the large difference in power between the two analysis methods.As expected, under the same sample size allocation and the log odds ratio, analyzing the new trial with the existing network is more powerful than without.This increase in power is directly attributed to the smaller SE of analyzing with the existing network.As is shown in Table 1, the differences in power, and standard error between the two sample size allocation strategies are minimal.The magnitude of the difference between two allocation strategies in the power or SE is too small to detect due to the randomness of the simulation process.For example, when the total sample size is 500 and the log odds ratio is 0.299, the simulation power is 46.41% for the even allocation while it is 46.13% for the optimal allocation when we analyze the new trial with the existing network.
The results of simulation II are shown in Table 2.The risk of CEFTP is a constant value, which is estimated from the existing network.For each log odds ratio between CEFTP and TILD, again the results represent analysis with and with the network and the two sample size allocation strategies.For both allocation strategies, our goal is to achieve at least 80% power under the condition of analyzing with the existing network.For each analysis, we calculate the following two metrics: power and SE.We can see that as before leveraging the network increases power.When analyzing the new trial with the existing network the power is about 80% because it is our goal when calculating the optimal sample size.The power of analyzing without the existing network is about 70% and 42% for the log odds ratio 0.299 and 0.5, respectively.This is expected from the result of Simulation I.Under the same sample size for each treatment, the SE of analyzing without the existing network is always larger than that of with, so that the power of analyzing without the existing network is always smaller than that of with.Another aim of Simulation II is to compare the optimal allocation and even allocation.Under our simulation setting, we did not observe any obvious difference in the total sample sizes needed.For example, when the log odds ratio is 0.299, the average total sample size needed across 10,000 simulations is 1666 when no restriction is added to the optimization problem, while it is 1668 when the even allocation requirement is added.* We set 0.299 as one of the log odds ratios in simulation scenarios because it is the estimated log odds ratio between CEFTP and TILD from the existing network. 1 The simulation power is calculated directly from the simulation by the proportion of the significance indicator equal to 1. 2 The formula power is the average power across 10,000 formula power calculations.In each simulation round, power was calculated based on Eq (5) and then averaged across 10,000 rounds to obtain the formula power. 3The simulation SE is the SE averaged across 10,000 SEs, with each standard error calculated based on the actual simulated data from the corresponding simulation round. 4The formula SE is the SE averaged across 10,000 formula SEs, with each standard error calculated based on Eq (6) using the true parameter values. https://doi.org/10.1371/journal.pone.0296020.t001

Application tool: R Shiny webpage
Our goal here is the introduce two tools that can help researchers readily use the approaches we have presented.We do this with an application and an R package.The application can be accessed from https://fangshu.shinyapps.io/CalSampleSize/.The screenshot of two examples are shown in Figs 4 and 5.We will provide details of the steps and data required to use the R Shiny web page below.
Step 1 In step 1, a dataset representing the existing evidence should be uploaded.A sample dataset is provided and the uploaded dataset should have the same format as the sample dataset.Note here we use the contrast-level data.
Step 2 Step 2 is for choosing the treatments in your future two-arm trial.The options wouldn't appear unless you complete step 1, and it contains all the treatments appeared in the existing evidence.The order of choosing the treatment doesn't matter.When you select the second treatment, it will automatically eliminate the one you choose first so that you don't bother with choosing the same two treatments.
Step 3 Step 3 is to assign the values of parameters used for calculating the optimal sample size.Since we use the contrast-level data, it's impossible to get the risk of each treatment unless we know the risk of one treatment.Therefore, you need to input the risk of one treatment.After entering the risk, it will tell you the risk of the other treatment combining the information of existing network and your input risk.It's up to you to use the risk of the other treatment from the existing network or enter the risk by yourself.Now we have the risk of two treatments in hand, all we need to calculate the optimal sample size is a pre-specified power.The default value is 0.8 but you can change it to fit your need.
Step 4 Step 4 is irrelevant to the optimal sample size calculation, and it's for showing the cost of different strategies (with/without existing NMA and even/uneven allocation).If the cost of each animal or each treatment is not clear at this moment, you can choose 'No' to avoid further input.Otherwise, you need to input the cost per treatment and per animal in this step.

Output panel
The output panel consists of three parts.At the top, the standard error of estimated log odds ratio between two treatments by existing network is given.In the middle, the optimal sample size for each treatment is calculated under four scenarios: analyze with existing network; analyze with the existing network and restrict the allocation to be the same for two treatments; analyze in isolation; analyze in isolation and restrict the allocation to be the same for two treatments.Note that the table has an additional column of costs if the costs are entered in step 4. At the bottom, there is a brief summary of the table above.

The package
The methods outlined in the previous sections are implemented in an R package called OssaNMA.The package can be used for using information from existing network meta-analyses to optimize or allocate the sample size of a new two-arm trial with a binary outcome.Two functions and one example dataset are included in the package.

ssnma
The first main function is the following: ssnma(p1, p2, enma_sigma, power.level,sig.level = 0.05, method = "with", allocation = "uneven") The available arguments are: • p1 Risk of treatment 1 • p2 Risk of treatment 2 • enma_sigma Standard error of the estimated effect size (log odds ratio) between treatment 1 and treatment 2 from the existing network • power.levelPower of test we want to obtain • sig.levelSignificance level, the default value is 0.05 • method a character string specifying the method of analyzing the new trial, must be one of 'with' (default) or 'without' • allocation a character string specifying the type of sample size allocation between two groups, must be one of 'uneven' (default) or 'even' This function returns a list with the following components: • sample_size Sample size for each treatment group • power Power of the test Assuming a new two-arm trial comparing treatment 1 and treatment 2 is to be planned.The two treatments exist in the existing network, which serves as a foundation to analyze the new trial with the existing network using NMA.
Given that the risk of treatment 1 is 0.2, the risk of treatment 2 is 0.3, and the standard error of the estimated effect size between two treatments from the existing NMA is 0.3, ssnma() can be applied to solve the minimum required total sample size for the new trial to achieve a power of 0.8 and allocate it to each treatment group under different allocation method (even or uneven) and analysis method (with or without the existing network).
The optimal sample size for each treatment group when the new trial is analyzed with the existing network is the following: R> ssnma(p1 = 0.2, p2 = 0.3, enma_sigma = 0.3, power.level= 0.8, + sig.level = 0.05, method = "with", allocation = "uneven") $sample_size [1] 187 163 $power [1] 0.801 The optimal sample size under even allocation for each treatment group when the new trial is analyzed with the existing network is the following: R> ssnma(p1 = 0.2, p2 = 0.3, enma_sigma = 0.3, power.level= 0.8, + sig.level = 0.05, method = "with", allocation = "even") $sample_size [1] 176 176 $power [1] 0.801 The optimal sample size under even allocation for each treatment group when the new trial is analyzed without the existing network is the following: R> ssnma(p1 = 0.2, p2 = 0.3, enma_sigma = 0.3, power.level= 0.8, + sig.level = 0.05, method = "without", allocation = "uneven") $sample_size [1] 317 277 $power [1] 0.801 R> ssnma(p1 = 0.2, p2 = 0.3, enma_sigma = 0.3, power.level= 0.8, + sig.level = 0.05, method = "without", allocation = "even") $sample_size [1] 298 298 $power [1] 0.801 ssanma The second main function is the following: ssnma(p1, p2, enma_sigma, power.level,sig.level = 0.05, method = "with", allocation = "uneven") The available arguments are: • enma_sigma Standard error of the estimated effect size (log odds ratio) between treatment 1 and treatment 2 from the existing network • N: Number of total sample size • sig.levelSignificance level, the default value is 0.05 • method a character string specifying the method of analyzing the new trial, must be one of 'with' (default) or 'without' • allocation a character string specifying the type of sample size allocation between two groups, must be one of 'uneven' (default) or 'even' This function returns a list with the following components: • sample_alloc Sample size allocation to each treatment group • power Power of the test Assume that we have the same new trial planned as section ssnma, the goal in this section is to calculate the optimal sample size allocation to each treatment group with a fixed total sample size of 200 to maximize the power, ssanma() is used and it covers the allocation under different allocation method (even or uneven) and analysis method (with or without the existing network).Take the uneven allocation for example, the optimal allocations under both analysis methods are the following: The optimal sample allocation when we analyze the new trial traditionally is the same as analyzing it with the existing network, as explained in Materials and methods.However, the power decreased greatly compared to analyzing it with the existing network.

Empirical illustrations
We consider the problem of working with the identical dataset as introduced in Dataset description.After loading the OssaNMA package and additional netmeta [15] package to calculate the standard error of the estimated effect size, we load the example data from the OssaNMA as the following: In the dataset, each row represents the summary statistics for a pairwise comparison between two treatments in a trial.See the meaning of each column below: • studlab: study id • treat1: name of treatment 1 • treat2: name of treatment 2 • TE: estimated treatment effect size (log odds ratio) between treat1 and treat2 • seTE: standard error of TE Let's conduct a network meta-analysis using this dataset: R> library("netmeta") R> nma_res <netmeta(TE, seTE, treat1, treat2, studlab, + data=BRDdat, sm="OR", comb.fixed= T, comb.random= F) Assuming a new two-arm trial comparing CEFTP and TILD is to be planned.To apply the functions in OssaNMA to help to plan the new trial, we need to have the standard error of the estimated effect size between the two treatments, CEFTP and TIILD, from the existing network.We can get the value by: R> enma_sigma <-nma_res$seTE.fixed['Ceftiofurpin','Tildipirosin'] R> enma_sigma Also, we need to know the risk of two treatments in the new trial.Some options are: • Taking No active control (NAC) as a baseline treatment, we can calculate the estimated log odds ratio between NAC and other treatments using NMA.As for the risk of NAC, we can get it by pooling the arm-level data from the existing network if any.
• Use other sources of evidence to assign the risk of two treatments.
Take the first option for example: This is the value of p1 and p2: R> p1 [1] 0.1868955

R> p2
[1] 0.2366667 With p1, p2, and enma_sigma obtained from the existing NMA, we can solve the minimum required total sample size for the new trial to achieve a pre-specified power using ssnma() or calculate the optimal sample size allocation to each treatment group with a fixed total sample size to maximize the power using ssanma(), as how we applied the two functions in the previous section when we have specified values of the input parameters.
See the application using the p1, p2, and enma_sigma obtained from the existing NMA below: The first example shows that to solve the minimum required total sample size for the new trial to achieve a pre-specified power of 0.8 and allocate it to each treatment group when the new trial is analyzed with the existing network, ssnma() can be applied as the following: R> ssnma(p1 = p1, p2 = p2, enma_sigma = enma_sigma, power.level= 0.8, + sig.level = 0.05, method = "with", allocation = "uneven") $sample_size [1] 853 782 $power [1] 0.8 The second example shows that to calculate the optimal sample size allocation to each treatment group with a fixed total sample size of 800 to maximize the power when the new trial is analyzed with the existing network, ssanma() is used as the following: R> ssanma(p1 = p1, p2 = p2, enma_sigma = enma_sigma, N = 800, + sig.level = 0.05, method = "with") $sample_alloc [1] 417 383 $power [1] 0.588

Discussion
Network meta-analysis of the existing evidence provides a quantitative framework to enlighten the design of new trials.Several previous studies have discussed approaches to planning future studies based on the network meta-analysis [2,4,5].These papers focused on designing a series of trials.While in this paper, the focus is on a two-arm trial where both treatments have been included in the existing network but there was no direct comparison.Clearly, designing one trial is more realistic than designing a series of trials.Additionally, this paper focuses on the new trial itself instead of the result of the updated meta-analysis.In this paper, we purposed a method to calculate the optimize sample allocation to improve the power of the comparison of interest in the new trial given the sample size fixed.As expected, leveraging information from existing network can improve power or reduce required sample size.Besides, we found that the difference between even allocation and optimal allocation is little.Since we focused on a specific future trial, the formulas described in this paper are easy to be implemented.To make our method more feasible to trial planners, an R Shiny app and OssaNMA package are deployed to calculate the optimal sample size.
In planning future trials, under the condition that a well-conducted NMA is available for leveraging information, our methods have primary use in determining the sample size needed for each treatment when our goal is to achieve a pre-specified power.It could also be used in determining the sample size allocation when our goal is to maximize the power when the total sample size is fixed.Though we showed that the even and uneven allocation have no obvious difference in power, it is still worth exploring in application if the cost of each treatment is taken into consideration.
There are some limitations in this paper.First, the goal of this paper is to improve the power of a new trial when the total sample size is fixed or to reduce the sample size needed when a power level is pre-specified to achieve, but there are other aspects we didn't consider such as the precision of estimates, the costs of different treatments.Second, as the methods described in this paper are based on network meta-analysis, it is only applicable to cases where a well-conducted NMA is available and there is no big variability across trial settings.Third, we only focus on a specific trial design in this paper, which is, two-arm trial with both treatments in the existing network but didn't have direct comparison.Though it is quite common, there are still other kinds of designs that are worth exploring.For example, a new trial involved a new treatment.
Future research related to this paper could be conducted in the following directions.First, instead of considering a new trial that contains two existing treatments, it would be useful to understand how to design a new trial that contains one existing treatment and one new treatment.Second, leveraging information from existing network to inform the design of new trial could break the assumed lack of dependence between studies.In particular, if a study is performed because of a statistically significant finding in an early study, this may lead to some potential problems.Further investigation needs to be conducted.

Conclusion
To conclude, first, borrowing information from the existing network meta-analysis is resource-saving compared with analyzing without it when our goal is to achieve a pre-specified power.Secondly, borrowing information from the existing network meta-analysis increases power compared with analyzing without the existing network when the total sample size is fixed.Thirdly, the optimal sample size allocation for each treatment is uneven for binary outcomes; however, this difference between the even and uneven allocation is practically ignorable.The last statement is true for both analysis methods (with/without the existing network) and both goals (the optimal allocation for fixed sample size or a pre-specified power).Lastly, This paper has presented the R package OssaNMA which provides a convenient set of tools for calculating the minimum total sample size needed to achieve a pre-specified power or the optimal allocation for each treatment group with a fixed total sample size to maximize the power.Examples illustrating the use of the package in practical applications have been presented.Besides, our R Shiny app provides a means to implement the above calculations and is freely available to practitioners.We encourage clinical trial planners to utilize our package or the online tool for optimal sample size/allocation calculation to achieve more efficient and powerful trial designs.

Fig 1 .
Fig 1. Variance formulas and the optimization problem in a new two-arm trial when our goal is to get maximum power with a fixed total sample size.https://doi.org/10.1371/journal.pone.0296020.g001

Fig 2 .
Fig 2. Power formulas and the optimization problem in a new two-arm trial when our goal is to minimize total sample size with a pre-specified power.https://doi.org/10.1371/journal.pone.0296020.g002

Fig 3 .
Fig 3.An existing network of interventions for the treatment of Bovine Respiratory Disease (BRD) in feedlot cattle with a new study between CEFTP(A) and TILD(B).Each node represents a treatment, with a total of 13 treatments in the existing network.A line connecting two treatments indicates a direct comparison between them.The grey lines represent trials in the existing network, while the black line represents the new trial connecting CEFTP and TILD.https://doi.org/10.1371/journal.pone.0296020.g003

Fig 4 .
Fig 4.An example of using the R Shiny app webpage without the cost output selected.A sample dataset is provided for ease of use.https://doi.org/10.1371/journal.pone.0296020.g004

Table 1 . Comparison of power and standard error for the new trial under different analysis methods and different sample size allocation strategies given the total sample size.
Simulation results are based on 10000 samples.

Table 2 . Comparison of required total sample size, power, and standard error for the new trial under different analysis methods and different sample size allocation strategies given the power is at least 80% when analyze with existing network.
Simulation results are based on 10000 samples.
* We set 0.299 as one of the log odds ratios in simulation scenarios because it is the estimated log odds ratio between CEFTP and TILD from the existing network.https://doi.org/10.1371/journal.pone.0296020.t002